<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">FBA订单销量统计</h3></div>
            <div class="panel-body">
                <form id="form" action="__URL__/sku_quantity" method="POST">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="col-sm-12 col-md-3  add-space">
                                    <div class="input-group input-group-md">
                                        <span class="input-group-addon">帐号</span>
                                        <select class="chosen-select form-control" tabindex="-1" name="account_id"
                                                data-name-group="common">
                                            <option value="" class="empty-opt">-- 请选择 --</option>
                                            <volist name="accounts" id="vo">
                                                <option value="{$vo.id}">
                                                    {$vo.name}
                                                </option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-sm-12 col-md-2  add-space">
                                    <div class="input-group input-group-md">
                                        <span class="input-group-addon">SKU</span>
                                        <input class="form-control " placeholder="请输入YKS SKU" name="sku"
                                               data-name-group="" type="text" value="" >
                                    </div>
                                </div>
                                <div class="col-sm-12 col-md-5  add-space">
                                    <div class="input-group input-group-md">
                                        <span class="input-group-addon">订单下单时间</span>
                                        <input class="form-control form-datetime" name="purchase_date_start" type="text" value="">
                                        <span class="input-group-addon"><span class="icon-calendar"></span></span>
                                        <input class="form-control form-datetime" name="purchase_date_end" type="text" value="">
                                    </div>
                                </div>
                                <div class="col-md-2 add-space">
                                    <input class="btn btn-primary jsSearchBtn" type="button" value="搜索">
                                    <input name="download" type="hidden" value="0">
                                    <input class="btn btn-primary jsDownloadBtn" type="button" value="下载">
                                </div>
                            </div>
                            <div class="clearfix"></div>
                            <hr>
                        </div>
                    </div>
                </form>
                <table id="example" class="table table-striped  table-hover" cellspacing="0" width="100%">
                    <thead>
                    <th>订单号</th>
                    <th>下单时间</th>
                    <th>SKU</th>
                    <th>虚拟SKU</th>
                    <th>订单状态</th>
                    <th>个数</th>
                    </thead>
                    <tbody>
                        <volist name="data" id="v" value="k">
                            <tr  <if condition="$v.order_status eq 'Cancelled' ">style='color:red'</if>>
                            <td>{$v.amazon_order_id}</td>
                            <td>{$v.purchase_date}</td>
                            <td>{$v.sku}</td>
                            <td>{$v.virtual_sku}</td>
                            <td>{$v.order_status}</td>
                            <td>{$v.quantity}</td>
                            </tr>
                        </volist>
                    </tbody>
                </table>
                <div class="pull-left">
                    <span><b>总计：</b></span><php>echo $mount['totalAmount']</php><br/>
                    <span style="color: #91bef0"><b>有效数：</b></span><php>echo $mount['valid_count'] </php><br/>
                    <span style="color: #ff0000"><b>取消数：</b></span><php>echo $mount['cancel_count']</php>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $("select[name='account_id']").val("<?php echo $condition['account_id']?>");
        $('select.chosen-select').chosen({
            no_results_text:'没有找到',   // 当检索时没有找到匹配项时显示的提示文本
            disable_search_threshold: 2, // 2个以下的选择项则不显示检索框
            search_contains: true        // 从任意位置开始检索
        });

        $("input[name='purchase_date_start']").val("<?php echo $condition['purchase_date_start']?>");
        $("input[name='purchase_date_end']").val("<?php echo $condition['purchase_date_end']?>");
        $("input[name='sku']").val("<?php echo $condition['sku']?>");
    });

    $(function () {
        $('.jsSearchBtn').click(function(){
            if (!$.trim($("input[name='sku']").val())) {
                layer.msg("请输入SKU!", {icon : 5});
                return false;
            }
            $('#form').submit();
        });

        $('.jsDownloadBtn').click(function(e){
            if (!$.trim($("input[name='sku']").val())) {
                e.preventDefault();
                layer.msg("请输入SKU!", {icon : 5});
                return false;
            }
            $("input[name='download']").val(1);
            $('#form').submit();
        });


    })
</script>
